import {
	http
} from './http.js'

export default {
	async getUserPersonalInformation() {
		const {
			data: res
		} = await http({
			url: '/api/user/personalInformation/exhibition',
			header: {
				'Authorization': uni.getStorageSync('token')
			},
			method: 'GET',
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		try {
			uni.setStorageSync('user', res.data);
		} catch (e) {
			return uni.showToast({
				title: '连接网络错误，请检查网络是否连接！',
				icon: "none"
			});
		}
		return res.data;
	},
	async getBanners() {
		const {
			data: res
		} = await http({
			url: '/api/sys/banner/lists',
			method: 'GET',
			data: {
				'type': 'HOME'
			}
		})
		if (res.code === 200) return res
		if (res.code === 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async getSuggestGoods() {
		const {
			data: res
		} = await http({
			url: '',
			method: '',
			data: {

			}
		})
		if (res.code === 200) return res
		if (res.code === 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async login(userPhone, password) {
		const {
			data: res
		} = await http({
			url: '/api/user/login',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			method: 'POST',
			data: {
				userPhone: userPhone,
				password: password
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		try {
			uni.setStorageSync('user', res.data);
		} catch (e) {
			return uni.showToast({
				title: '连接网络错误，请检查网络是否连接！',
				icon: "none"
			});
		}
		return true;
	},
	async getConList(){
		const {data:res} = await http({
			url:'/api/sys/con_list',
			method: 'get',
		})
	},
	async searchByKeyWords(data1,page,limit) {
		const {
			data: res
		} = await http({
			url: '/api/market/search',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'keywords': data1,
				'page':page,
				'limit':limit
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},
	async getInitial(page,limit) {
		const {
			data: res
		} = await http({
			url: '/api/market/marketHome',
			method: 'GET',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'page':page,
				'limit':limit
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},
	async verifyPhone(userPhone, sms) {
		const {
			data: res
		} = await http({
			url: '/api/user/personalInformation/checkIdentityByPhone',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'POST',
			data: {
				userPhone: userPhone,
				sms: sms
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '验证失败',
				icon: "none"
			});
		}
		return res.data;
	},
	async getGoodsDetails(data1,page,limit) {
		const {
			data: res
		} = await http({
			url: '/api/market/details',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'goodsId':data1,
				'page':page,
				'limit':limit
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},
	async addGoodsCar(goodsId,specsId,price,number) {
		const {
			data: res
		} = await http({
			url: '/api/market/addCar',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'goodsId':goodsId,
				'specsId':specsId,
				'number':number,
				'price':price
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},

	async updatePhone(userPhone, sms) {
		const {
			data: res
		} = await http({
			url: '/api/user/personalInformation/updateByNewPhone',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'PUT',
			data: {
				userPhone: userPhone,
				sms: sms
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '修改失败',
				icon: "none"
			});
		}
		return res.data;
	},
	async ordinaryRegister(userPhone, password, sms) {
		const {
			data: res
		} = await http({
			url: '/api/user/ordinary/register',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			method: 'POST',
			data: {
				userPhone: userPhone,
				password: password,
				sms: sms,
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '注册失败',
				icon: "none"
			});
		}
		return res.data;
	},
	async dietitianRegister(userPhone, password, sms, certificateImg, idcardImg) {
		const {
			data: res
		} = await http({
			url: '/api/user/dietitian/register',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			method: 'POST',
			data: {
				userPhone: userPhone,
				password: password,
				sms: sms,
				certificateImg: certificateImg,
				idcardImg: idcardImg
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '注册失败',
				icon: "none"
			});
		}
		return res.data;
	},

	async addGoodsCollect(goodsId) {
		const {
			data: res
		} = await http({
			url: '/api/market/collect',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'goodsId':goodsId
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},
	async verifyPassword(password) {
		const {
			data: res
		} = await http({
			url: '/api/user/personalInformation/checkPassword',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'POST',
			data: {
				password: password,
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '验证失败',
				icon: "none"
			});
		}
		return res.data;
	},
	async commitOrder(orderList) {
		const {
			data: res
		} = await http({
			url: '/api/market/commitOrder',
			method: 'POST',
			header: {
				'Content-Type': 'application/json'
			},
			data: {
				'orderList':order
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},
	async forgetToUpdatePassword(userPhone, password, sms) {
		const {
			data: res
		} = await http({
			url: '/api/user/forgetToUpdatePassword',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			method: 'PUT',
			data: {
				userPhone: userPhone,
				password: password,
				sms: sms
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '网络连接异常！',
				icon: "none"
			});
		}
		return res.data;
	},
	async getOrderSelect(data1) {
		const {
			data: res
		} = await http({
			url: '/api/user/order/check',
			method: 'GET',
			data: {
				limit: data1.limit,
				size: data1.size,
				orderStatus: data1.orderStatus
			},
		})
		if (res.code == 200) return res
		if (res.code == 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async updatePassword(password) {
		const {
			data: res
		} = await http({
			url: '/api/user/personalInformation/updatePassword',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'PUT',
			data: {
				password: password,
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '验证失败',
				icon: "none"
			});
		}
		return res.data;
	},
	async pay(temporaryIdList) {
		const {
			data: res
		} = await http({
			url: '/api/market/pay',
			method: 'POST',
			header: {
				'Content-Type': 'application/json'
			},
			data: temporaryIdList
			
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},
	async getGoodsByCategory(category,page,limit) {
		const {
			data: res
		} = await http({
			url: '/api/market/category',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'category': category,
				'page': page,
				'limit': limit
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'+res.code
		})
	},

	async sendSMS(userPhone) {
		const {
			data: res
		} = await http({
			url: '/api/user/ordinary/register/sendSMS',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			method: 'GET',
			data: {
				userPhone: userPhone
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '发送失败',
				icon: "none"
			});
		}
		console.log(res.data);
		return uni.showToast({
			title: res.data,
			icon: "none"
		});
	},
	async isPurchase(goodsId,page,limit) {
		const {
			data: res
		} = await http({
			url: '/api/market/isPurchase',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'goodsId':goodsId,
				'page':page,
				'limit':limit
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},

	async getqiniuyunToken() {
		const {
			data: res
		} = await http({
			url: '/api/sys/qiniu',
			method: 'GET',
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		return res.data;
	},
	async showEvaluate(productId,page,limit) {
		const {
			data: res
		} = await http({
			url: '/api/market/showEvaluate',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'productId':productId,
				'page':page,
				'limit':limit
			}
		})
		if (res.code === 200) return res
		if (res.code != 200) return uni.showToast({
			title: '请求失败'
		})
	},
	async applyDietitian(certificateImg, idcardImg) {
		const {
			data: res
		} = await http({
			url: '/api/user/dietitian/apply',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'POST',
			data: {
				certificateImg: certificateImg,
				idcardImg: idcardImg
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '申请失败',
				icon: "none"
			});
		}
		return res.data;
	},
	async changeUserPersonalInformation(user) {
		if (user.userVip === '非会员') {
			user.userVip = 0
		} else if (user.userVip === '会员') {
			user.userVip = 1
		}
		if (user.isDietitian === '非营养师') {
			user.isDietitian = 0
		} else if (user.isDietitian === '营养师') {
			user.isDietitian = 1
		}
		if (user.userSex === '女') {
			user.userSex = 0
		} else if (user.userSex === '男') {
			user.userSex = 1
		}
		const {
			data: res
		} = await http({
			url: '/api/user/personalInformation/modify',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'PUT',
			data: {
				userImg: user.userImg,
				userNickname: user.userNickname,
				userSex: user.userSex,
				userAge: user.userAge,
				userNation: user.userNation,
				userName: user.userName,
				userIdcard: user.userIdcard
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '网络连接异常！',
				icon: "none"
			});
		}
		try {
			uni.setStorageSync('user', res.data);
		} catch (e) {
			return uni.showToast({
				title: '连接网络错误，请检查网络是否连接！',
				icon: "none"
			});
		}
		return res.data;
	},
	async setUserInfo(data) {
		const {
			data: res
		} = await http({
			url: '/api/user/physique_info',
			method: 'POST',
			data: data,
			// header:{
			// 	Content-Type:"application/x-www-form-urlencoded"
			// }
		})
	},
	async search(datas) {
		const {
			data: res
		} = await http({
			url: '/api/market/search',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				keywords: datas
			}
		})
		if (res.code === 200) {
			return res
		} else {
			return uni.showToast({
				title: "请求失败"
			})
		}
	},
	async uploadVideo(video) {
		const {
			data: res
		} = await http({
			url: '/api/user/dietitian/video/upload',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'POST',
			data: {
				videoAddress: video.videoAddress,
				videoKeyword: video.videoKeyword,
				videoTypeId: video.videoTypeId,
				videoIntroduce: video.videoIntroduce,
				goodsId: video.goodsId
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '上传失败',
				icon: "none"
			});
		}
		return res.data;
	},
	async verifyIdCard(userName, userIdcard) {
		const {
			data: res
		} = await http({
			url: '/api/user/personalInformation/checkIdentityByIdCard',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'POST',
			data: {
				userName: userName,
				userIdcard: userIdcard
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '验证失败',
				icon: "none"
			});
		}
		return res.data;
	},
	async getGoods(page) {
		const {
			data: res
		} = await http({
			url: '/api/market/marketHome',
			method: 'GET',
			data: page
		})
		if (res.code === 200) {
			return res
		}
	},
	async newAddress(data1) {
		const {
			data: res
		} = await http({
			url: '/api/user/address/add',
			method: 'POST',
			header: {
				'Content-Type': 'application/json',
				'Authorization': uni.getStorageSync('token')
			},
			data: {
				"receiveName": data1.receivename,
				"receivePhone": data1.receivephone,
				"provinceId": data1.provinceid,
				"cityId": data1.cityid,
				"areaId": data1.areaid,
				"address": data1.address,
				"addressStatus": data1.addressstatus,
			}
		})
	},
	//查询地址
	async getAddressSelect(data1) {
		const {
			data: res
		} = await http({
			url: '/api/user/address/check',
			method: 'GET',
			data: {
				limit: data1.limit,
				size: data1.size
			}
		})
		if (res.code == 200) return res
		if (res.code == 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async offShelfVideo(videoId) {
		const {
			data: res
		} = await http({
			url: '/api/user/dietitian/video/offShelf',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': uni.getStorageSync('token')
			},
			method: 'DELETE',
			data: {
				videoId: videoId
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		if (!res.data) {
			return uni.showToast({
				title: '网络异常，下架失败',
				icon: "none"
			});
		}
		return res.data;
	},
	//删除地址
	async AddressDelete(addressId) {
		const {
			data: res
		} = await http({
			url: '/api/user/address/delete',
			method: 'DELETE',
			data: {
				addressId: addressId
			}
		})
	},
	//编辑地址
	async AddressUpdate(data1) {
		const {
			data: res
		} = await http({
			url: '/api/user/address/update',
			method: 'PUT',
			data: data1
		})
		if (res.code == 200) return res
		if (res.code == 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async quaryDietitianAllVideo(page, limit, videoApply, videoStatus) {
		const {
			data: res
		} = await http({
			url: '/api/user/dietitian/video/quaryDietitianAllVideo',
			header: {
				'Authorization': uni.getStorageSync('token')
			},
			method: 'GET',
			data: {
				page: page,
				limit: limit,
				videoApply: videoApply,
				videoStatus: videoStatus
			},
		})
		if (res.code != 200) {
			return uni.showToast({
				title: res.msg,
				icon: "none"
			});
		}
		return res.data.list;
	},
	async getCollectSelect(data1) {
		const {
			data: res
		} = await http({
			url: '/api/user/collect/check',
			method: 'GET',
			data: {
				limit: data1.limit,
				size: data1.size,
			},
		})
		if (res.code == 200) return res
		if (res.code == 400) return uni.showToast({
			title: '请求失败'
		})
	},

	async getCollectDelete(collectId) {
		const {
			data: res
		} = await http({
			url: '/api/user/collect/delete/'+evaluateId,
			method: 'DELETE',
			data: {
				collectId: collectId
			},
		})
		if (res.code == 200) return res
		if (res.code == 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async getUserInfo() {
		const {
			data: res
		} = await http({
			url: '/api/user/user_physique_info',
			method: 'GET',
		})
		return res;
	},
	async getSearch(data) {
		const {
			data: res
		} = await http({
			url: '/api/forum/question/search?keyword=' + data.key + '&page=' + data.page + '&limit=' + data
				.limit,
			method: 'GET'
		})
		if (res.code === 200) return res
		if (res.code === 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async getMyPost(data) {
		const {
			data: res
		} = await http({
			url: '/api/forum/question/details',
			method: 'GET'
		})
		if (res.code === 200) return res
		if (res.code === 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async getEditPost(data) {
		const {
			data: res
		} = await http({
			url: '/api/forum/question/put',
			method: 'PUT',
			header: {
				'Content-Type': 'application/json'

			},
			data: data
		})
		if (res.code === 200) return res
		if (res.code === 400) return uni.showToast({
			title: '请求失败'
		})
	},
	async getComment(data) {
		const {
			data: res
		} = await http({
			url: '/api/forum/comment/put',
			method: 'PUT',
			data: data
		})
		return res
	},
	async queryAll(page, limit) {
		const {
			data: res
		} = await http({
			url: '/api/forum/question/queryAll',
			method: 'GET',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				page: page,
				limit: limit
			}
		})
		return res;
	},
	
	
	// .........。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。根据关键字搜索视频
		async getVideoKeyword(videoKeyword) {
			const {
				data: res
			} = await http({
				url: '/api/video/search?videoKeyword=' + videoKeyword + '&page=1&size=2',
				method: 'GET',
	
			})
			if (res.code === 200) return res
			if (res.code === 400) return uni.showToast({
				title: '请求失败'
			})
		},
		// 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。视频分类
		async getCategory(category) {
			// console.log(category);
			const {
				data: res
			} = await http({
				url: '/api/video/category?page=1&size=2&category=' +category,
				method: 'GET'
			})
			if (res.code === 200) return res
			if (res.code === 400) return uni.showToast({
				title: '请求失败'
			})
		},
	// ................................................................................热门视频
		async getHot() {
			// console.log(category);
			const {
				data: res
			} = await http({
				url: '/api/video/hot?page=1&size=2',
				method: 'GET',
				header: {
					'Content-Type': 'application/x-www-form-urlencoded'
				}
			})
			if (res.code == 200) return res
			if (res.code == 400) return uni.showToast({
				title: '请求失败'
			})
		},
	//...............................................................................收藏视频
		async videoCollect(videoId) {
			const {
				data: res
			} = await http({
				url: '/api/video/collect?videoId='+videoId,
				method: 'GET',
				header: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
			})
			if (res.code == 200) return res
			if (res.code == 400) return uni.showToast({
				title: '请求失败'
			})
		},
		//...............................................................................查询收藏视频
			async selectVideoCollect(videoId) {
				const {
					data: res
				} = await http({
					url: '/api/video/selectCollect?videoId='+videoId,
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
				})
				if (res.code == 200) return res
				if (res.code == 400) return uni.showToast({
					title: '请求失败'
				})
			},
		//...............................................................................视频点赞
			async praiseVideo(videoId) {
				const {
					data: res
				} = await http({
					url: '/api/video/praise',
					method: 'POST',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data:{
						'videoId':videoId
					}
				})
				if (res.code == 200) return res
				if (res.code == 400) return uni.showToast({
					title: '请求失败'
				})
			},
			
			//...............................................................................视频评论
				async evaluateVideo(videoId,evaluateContent) {
					const {
						data: res
					} = await http({
						url: '/api/video/evaluate',
						method: 'POST',
						header: {
							'Content-Type': 'application/x-www-form-urlencoded'
						},
						data:{
							'videoId':videoId,
							'evaluateContent':evaluateContent
						}
					})
					if (res.code == 200) return res
					if (res.code == 400) return uni.showToast({
						title: '请求失败'
					})
				},
				
				
				//...............................................................................查询视频评论
					async selectEvaluateVideo(videoId) {
						const {
							data: res
						} = await http({
							url: '/api/video/selectEvaluate?page=1&size=2&videoId='+videoId,
							method: 'GET',
							 // //  以表单方式提交，将Object转换为form参数方式
							 //    data : $httpParamSerializer({
							 //        cycle : key,
							 //        emp_id : user.id
							 //    }),
							    //  新增content-type头部属性
							    heads : {
							        'content-type' : 'application/x-www-form-urlencoded'
							    }
						
						})
						if (res.code == 200) return res
						if (res.code == 400) return uni.showToast({
							title: '请求失败'
						})
					},
			
			//...............................................................................投诉视频
				async insertComplaint(videoId,evaluateContent) {
					const {
						data: res
					} = await http({
						url: '/api/video/complaint',
						method: 'POST',
						header: {
							'Content-Type': 'application/x-www-form-urlencoded'
						},
						data:{
							'videoId':videoId,
							'evaluateContent':evaluateContent
						}
					})
					if (res.code == 200) return res
					if (res.code == 400) return uni.showToast({
						title: '请求失败'
					})
				},
			
	//评论
	async getEvaluateSelect(data1) {
		const {
			data: res
		} = await http({
			url: '/api/user/evaluate/check',
			method: 'GET',
			data: {
				limit: data1.limit,
				size: data1.size,
			},
		})
		if (res.code == 200) return res
		if (res.code == 400) return uni.showToast({
			title: '请求失败'
		})
	},

	async getEvaluateDelete(evaluateId) {
		const {
			data: res
		} = await http({
			url: '/api/user/evaluate/delete/'+evaluateId,
			method: 'DELETE',
			
		})
		if (res.code == 200) return res
		if (res.code == 400) return uni.showToast({
			title: '请求失败'
		})
	},

	async orderCommit(list) {
		// console.log(category);
		const {
			data: res
		} = await http({
			url: '/api/market/commitOrder',
			method: 'POST',
			header: {
				'Content-Type': 'application/json'
			},
			data: list
		})
		return res;
	},

	async getCarData(page, limit) {
		// console.log(category);
		const {
			data: res
		} = await http({
			url: '/api/market/showCar',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'page': page,
				'limit': limit
			}
		})
		return res;
	},

	async delCar(goodsId, specsId) {
		// console.log(category);
		const {
			data: res
		} = await http({
			url: '/api/market/delCar',
			method: 'POST',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'goodsId': goodsId,
				'specsId': specsId
			}
		})
		return res;
	},
	async getDictValue(data) {
		const {
			data: res
		} = await http({
			url: '/api/sys/dict/value',
			method: 'GET',
			data: {
				typeId: data.typeId,
				sysDictTypeValue: data.sysDictTypeValue
			}
		})
		if (res.code != 200) {
			return uni.showToast({
				title: "网络异常，请检查您的网络",
				icon: "none"
			})
		}
		return res.data
	},//采纳
	async upadteAdopt(data2) {
		const {
			data: res
		} = await http({
			url: '/api/forum/comment/deopt',
			method: 'PUT',
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			data: {
				'isAdopt':0,
				'returnContent':data2
			}
		})
		return res
},
	//删除
	async deletePost2(data) {
		const {
			data: res
		} = await http({
			url: '/api/forum/question/delete/'+data,
			method: 'DELETE',
		})
		return res
	},
	//@营养师
	async aitren(data) {
		const {
			data: res
		} = await http({
			url: '/api/user/personalInformation/showAllDietitian',
			method: 'POST',
			data: data
		})
		return res
	},
	
}
